package com.lz.config;

import org.mybatis.spring.SqlSessionFactoryBean;
import org.mybatis.spring.mapper.MapperScannerConfigurer;
import org.springframework.context.annotation.Bean;

import javax.sql.DataSource;

/**
 * @Author 小思
 * @Description //TODO
 * @Date $ $
 * @Param $
 * @return $
 **/

public class MybatisConfig {
    @Bean
    public SqlSessionFactoryBean sqlSessionFactoryBean(DataSource dataSource) {
        SqlSessionFactoryBean sq = new SqlSessionFactoryBean();
        sq.setTypeAliasesPackage("com.lz.pojo");
        sq.setDataSource(dataSource);
        return sq;
    }

    @Bean
    public MapperScannerConfigurer mapperScannerConfigurer() {
        MapperScannerConfigurer mp = new MapperScannerConfigurer();
        mp.setBasePackage("com.lz.dao");
        return mp;
    }
}
